Logistic regression treats \(f(x)\) as a (generalized) linear function
Allows for multiple qualitative classes
Ensures that estimates of \(F(\mathbf{s})\) are [0,1]
Beyond Linearity
Logistic (and other generalized linear models) are relatively interpretable
Probability theory allows robust inference of effects
Predictive power can be low
Relaxing the linearity assumption can help
Classification Trees
Use decision rules to segment the predictor space
Series of consecutive decision rules form a ‘tree’
Terminal nodes (leaves) are the outcome; internal nodes (branches) the splits
Classification Trees
Divide the predictor space (\(R\)) into \(J\) non-overlapping regions
Every observation in \(R_j\) gets the same prediction
Recursive binary splitting
Pruning and over-fitting
An Example
Inputs from the dismo package
base.path <-"/Users/mattwilliamson/Google Drive/My Drive/TEACHING/Intro_Spatial_Data_R/Data/2021/session28/"#sets the path to the root directorypres.abs <-st_read(paste0(base.path, "presenceabsence.shp"), quiet =TRUE) #read the points with presence absence data## OGR data source with driver: ESRI Shapefile ## Source: "/Users/matthewwilliamson/Downloads/session28/presenceabsence.shp", layer: "presenceabsence"## with 100 features## It has 1 fieldspred.files <-list.files(base.path,pattern='grd$', full.names=TRUE) #get the bioclim datapred.stack <-rast(pred.files) #read into a RasterStacknames(pred.stack) <-c("MeanAnnTemp", "TotalPrecip", "PrecipWetQuarter", "PrecipDryQuarter", "MinTempCold", "TempRange")plot(pred.stack)